/// @tags: Matrix
#include <cctype>
#include <cstdio>
#include <cstring>

namespace BlueQuantum {

typedef long long ll;

int const M = 1e2 + 5, mod = 1e9 + 7;

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

struct Matrix {
  static int m;
  int a[M][M];

  Matrix() { memset(a, 0, sizeof(a)); }

  inline Matrix operator*(Matrix const &rhs) const {
    Matrix res;
    for (int i = 0; i <= m; ++i)
      for (int j = 0; j <= m; ++j)
        for (int k = 0; k <= m; ++k)
          if ((res.a[i][j] += 1ll * a[i][k] * rhs.a[k][j] % mod) >= mod) res.a[i][j] -= mod;
    return res;
  }

  inline Matrix operator^(ll exp) {
    Matrix res;
    for (int i = 0; i <= m; ++i) res.a[i][i] = 1;
    while (exp) {
      if (exp & 1) res = res * *this;
      *this = *this * *this;
      exp >>= 1;
    }
    return res;
  }
} base, x;

ll n, a;
int p, q, P, Matrix::m;
int f[M];

inline ll qpow(ll base, ll exp) {
  ll res = 1;
  while (exp) {
    if (exp & 1) res = res * base % mod;
    exp >>= 1;
    base = base * base % mod;
  }
  return res;
}

inline int main() {
  read(n), read(a);
  P = 1ll * read(p) * qpow(read(q), mod - 2) % mod;
  int inv = qpow(P, mod - 2);
  if (a == 0) {
    printf("%lld", n % mod * inv % mod);
  } else if (p == q) {
    printf("%lld", n % mod);
  } else if (a == n) {
    printf("%lld", 1ll * inv * qpow(1 - inv + mod, mod - 2) % mod * (1 - qpow(inv, n) + mod) % mod);
  } else {
    Matrix::m = a + 1;
    int *const F = x.a[0];
    for (int i = 0, sum = 0, f = 0; i <= a; ++i) {
      f = (1ll * (inv - 1 + mod) * sum + inv) % mod;
      sum = (sum + f >= mod) ? sum + f - mod : sum + f;
      F[i] = sum;
    }
    F[a + 1] = 1;
    for (int i = 1; i <= a; ++i) base.a[i][i - 1] = 1;
    base.a[a + 1][a + 1] = 1, base.a[0][a] = (1 - inv + mod) % mod;
    base.a[a][a] = base.a[a + 1][a] = inv;
    x = x * (base ^ (n - a - 1));
    printf("%d", x.a[0][a]);
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("levelup.in", "r", stdin);
  freopen("levelup.out", "w", stdout);
#endif
#endif

  return BlueQuantum::main();
}